package site.wuao.simpledesignmode.singleton;

/**
 * 静态内部类单例模式
 *
 * @author wuao
 * @date 2017/11/5
 * @github {https://github.com/CoderWuao}
 * @blogs {http://wuao.site/}
 * @note -
 * ---------------------------------------------------------------------------------------------------------------------
 * @modified -
 * @date -
 * @github -
 * @blogs -
 * @note -
 */
public class Singleton {
    /**
     * 私有构造方法
     */
    private Singleton() {
    }

    /**
     * 获取单例对象
     *
     * @return 单例
     */
    public static Singleton getInstance() {
        return SingletonHolder.sInstance;
    }

    /**
     * 单例持有者
     */
    private static class SingletonHolder {
        private static final Singleton sInstance = new Singleton();
    }
}